package org.particlethink.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.particlethink.entry.PlanStatus;
import org.particlethink.model.MasterPlan;

import java.util.Date;
import java.util.List;

@Mapper
public interface MasterPlanMapper extends tk.mybatis.mapper.common.Mapper<MasterPlan> {
    @Select("select * from master_plans where project_id =   #{projectId}")
    List<MasterPlan> selectByProjectId(@Param("projectId") int projectId);
    @Select("select * from master_plans where project_id =  #{projectId} and status=2")
    List<MasterPlan> selectSubmittedByProjectId(@Param("projectId") int projectId);

    List<MasterPlan> selectMasterPlans(
            @Param("masterPlanNo") String masterPlanNo,
            @Param("projectIds") List<Integer> projectIds,
            @Param("masterPlanCategoryIds") List<Integer> masterPlanCategoryIds,
            @Param("status") PlanStatus status,
            @Param("submitUserIds") List<Integer> submitUserIds,
            @Param("submitStart") Date submitStart,
            @Param("submitEnd") Date submitEnd
    );

    List<MasterPlan> selectByDuration(@Param("startAt") Date startAt, @Param("endAt") Date endAt);
}
